package com.rimi.controller;


import com.rimi.bean.MenuType;
import com.rimi.bean.Video;
import com.rimi.service.MenuTypeService;
import com.rimi.service.SelectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/select")
public class SelectController {

    @Autowired
    private SelectService selectService;


    @RequestMapping("/index")
    public String index(Model model){
        String videoId="1";
        List<Video> videoList = selectService.getVideoList(videoId);
        List<String> videoTypeList = selectService.getVideoTypeList(videoId);
        List list = new ArrayList();
        for(int i=1 ; i<=videoList.get(0).getVideoNum() ; i++){
            list.add(i);
        }
        System.out.println(videoList.get(0).getVideoTime());
        model.addAttribute("videoNum",list);
        model.addAttribute("videos",videoList);
        model.addAttribute("videoTypes",videoTypeList);
        return "select";
    }

}
